package com.woniu.micropropertyserver.controller;

import com.github.pagehelper.PageInfo;
import com.woniu.microcommonsserver.entity.PassInfoEntity;
import com.woniu.micropropertyserver.bean.DeployPass;
import com.woniu.micropropertyserver.bean.DployPface;
import com.woniu.micropropertyserver.service.IPassInfoService;
import com.woniu.micropropertyserver.util.PageRest;
import com.woniu.micropropertyserver.util.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



/**
 * @author ：bb
 * @date ：Created in 2021/2/2 0002
 * @description：
 * @modified By：
 * @version: $
 */
@RequestMapping("/passInfo")
@RestController
public class PassInfoController {
    @Autowired
    private IPassInfoService passInfoServiceImpl;
    @GetMapping(value ="/findByParam",produces = MediaType.APPLICATION_JSON_VALUE )
    public ResultMsg findByParam(PageRest pageRest, DeployPass pass){
        System.out.println(pass);
        PageInfo<PassInfoEntity> passes=passInfoServiceImpl.findByParam(pageRest,pass);
        return new ResultMsg(200,"操作成功",passes);
    }
    @GetMapping(value ="/findOne",produces = MediaType.APPLICATION_JSON_VALUE )
    public ResultMsg findById(Long id){
        System.out.println(id);
       PassInfoEntity passes=passInfoServiceImpl.findById(id);
       if(passes !=null) {
           return new ResultMsg(200, "操作成功", passes);
       }
        return new ResultMsg(200, "操作成功", null);
    }
}
